<?php
require('includes/top.php');

$user_id = $_POST['user_id'];
$emp_fname = $_POST['emp_fname'];
$emp_lname = $_POST['emp_lname'];
$user_name = $_POST['user_name'];
$password = $_POST['password'];
$emp_desn = $_POST['emp_desn'];
$division = $_POST['division'];
$region = $_POST['region'];
$depot = $_POST['depot'];
$dispatch_location = $_POST['dispatch_location'];
$doc3 = $_POST['doc3'];



$sql = "UPDATE users SET `user_firstname` = '".$emp_fname."',`user_lastname` = '".$emp_lname."',`user_name` = '".$user_name."', `user_password` = '".$password."',`user_designation` = '".$emp_desn."',`depot` = '".$depot."' where user_id='".trim($user_id)."'";
$result=mysql_query($sql);

$sql1 = "UPDATE laptop SET `division` = '".$division."', `region` = '".$region."',`dispatch_location` = '".$dispatch_location."',`dispatch_date` = '".$doc3."' where user_id='".trim($user_id)."'";
$result1=mysql_query($sql1);


$sql2 = "UPDATE accessories SET `division` = '".$division."', `region` = '".$region."',`depot` = '".$depot."',`dispatch_location` = '".$dispatch_location."',`dispatch_date` = '".$doc3."' where user_id='".trim($user_id)."'";
$result2=mysql_query($sql2);


if($result>0)
{
header('Location: user_details.php?v=success');
}
else
{
header('Location: user_details.php?v=err');
}
?>